//
//  FKOrder.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/22.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKOrder.h"

@implementation FKOrder

+ (NSDictionary *)mj_objectClassInArray
{
    return @{@"goods_list" : [FKOrderGoods class],
             @"operationBtnStatuses" : [FKOperationBtnStatus class]
             };
}

- (void)mj_keyValuesDidFinishConvertingToObject
{
    _addTime = [_add_time fk_time];
    _payTime = [_pay_time fk_time];
    _fahuoTime = [_fahuo_time fk_time];
    _shouhuoTime = [_shouhuo_time fk_time];
    _orderSnText = fkFORMAT(@"订单号: %@", _order_sn);
    _countText = fkFORMAT(@"共%@件商品 合计: ", _total_num);
    _priceText = fkFORMAT(@"¥%@", _price);
    
    // 10=待付款  20=待发货  30=待收货  40=已完成  50=售后 90=取消订单
    NSMutableArray *array = [NSMutableArray array];
    if ([_status isEqualToString:@"10"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"立即支付" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"取消订单" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"20"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"取消订单" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"30"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"确认收货" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看物流" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"40"]) {
//        [array addObject:[FKOperationBtnStatus statusWith:@"去评价" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"50"]) {
//        [array addObject:[FKOperationBtnStatus statusWith:@"取消售后" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"90"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"删除订单" themeColor:fkColor333333]];
    }
    _operationBtnStatuses = array;
}

- (void)setVirtualOrder:(BOOL)virtualOrder
{
    _virtualOrder = virtualOrder;
    
    NSMutableArray *array = [NSMutableArray array];
    if ([_status isEqualToString:@"10"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"立即支付" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"取消订单" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"20"]) {
//        [array addObject:[FKOperationBtnStatus statusWith:@"核销" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"30"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"确认收货" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看物流" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"40"]) {
//        [array addObject:[FKOperationBtnStatus statusWith:@"去评价" themeColor:fkMainColor]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"50"]) {
        //        [array addObject:[FKOperationBtnStatus statusWith:@"取消售后" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
    } else if ([_status isEqualToString:@"90"]) {
        [array addObject:[FKOperationBtnStatus statusWith:@"查看详情" themeColor:fkColor333333]];
        [array addObject:[FKOperationBtnStatus statusWith:@"删除订单" themeColor:fkColor333333]];
    }
    _operationBtnStatuses = array;
}

@end
